<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><%=title%></title>
    <link rel="stylesheet" href="stylesheets/login.css"/>
    <script type="text/javascript">
        function formSubmit()
        {
            var phonenum = document.getElementById("phone").value;
            var spanerror = document.getElementById("spanerr");
            if (!(/^1[34578]\d{9}$/.test(phonenum))) {
                spanerror.style.display = "block";
            }
            else {
                spanerror.style.display = "none";
                var type = document.getElementById("type").value
                var xmlhttp;
                if (window.XMLHttpRequest) {
                    xmlhttp = new XMLHttpRequest();
                }
                else {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.open("GET", "/phapi?phonenum=" + phonenum + "&type=" + type, true);
                xmlhttp.send();

                var secs = 25;
                document.getElementById("Button1").disabled = true;
                for (i = 1; i <= secs; i++) {
                    window.setTimeout("update(" + i + "," + secs + ")", i * 1000);
                }
            }
        }
        function update(num,secs) {
            if (num == secs) {
                document.getElementById("Button1").value = "获取短信验证码";
                document.getElementById("Button1").disabled = false;
            }
            else {
                printnr = secs - num;
                document.getElementById("Button1").value = " (" + printnr + ")秒后重新发送";
            }
        }
    </script>
    <script>
        function loginSubmit()
        {
            var arrstr = document.cookie.split("; ");
            var code
            for (var i = 0; i < arrstr.length; i++) {
                var temp = arrstr[i].split("=");
                if (temp[0] == "smscodes") {
                    code = unescape(temp[1]);
                }
            }
            var spancode = document.getElementById("spancode");
            if (code == document.getElementById("smsCode").value) {
                spancode.style.display = "none";
                document.getElementById("form1").submit();
            }
            else {
                spancode.style.display = "block";
            }
        }
    </script>
</head>
<body style="font-family:微软雅黑">
<form id="form1" name="form1" action="checkuser" method="post">
    <div>
        <table border="0" align="center" style="height:100%">

            <tr valign="middle">
                <td style="height: 650px; background-image: url('images/01login/bj.png'); background-repeat: no-repeat; text-align: center;max-width:1200px">
                  <span style="font-size: 45px; color: #FFFFFF; white-space: nowrap;">欢迎来到国家医学考试系统
                  </span>
                    <p></p>
                    <span style="color: #FFFFFF; font-size: 25px; font-family: 'Century Gothic'; white-space: nowrap;">Welcome to the national medical examination system</span>
                </td>
                <td style="width: 700px; text-align: center;">
                    <div style="text-align: center"><span style="font-size: 40px; color: #34495e">登录/</span><span style="font-family: 'Century Gothic'; font-size: 30px; color: #34495e">Sign In</span></div>
                    <div style="height: 120px"></div>
                    <div style="width: 665px;margin:0 auto; text-align: left; font-size: 22px; color: #999999;">手机号</div>
                    <div style="width: 650px; text-indent: 15px; height: 50px; line-height: 50px;margin:0 auto; border-bottom-width: 1px; border-bottom-color: #231b54; border-bottom-style: solid;">
                        <table style="width:100%">
                            <tr>
                                <td>
                                    <input id="phone" name="phone" type="text" style="border-width: 0px; border-style: none; width: 100%; font-size: 20px; color: #231b54; height: 45px;outline:none;" />
                                </td>
                                <td style="width:200px"><span id="spanerr" style="font-size:20px;color:#ff0214; height: 23px; width: 100%; display:none; ">请输入正确手机号</span>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="height:45px"></div>
                    <div style="width: 665px;margin:0 auto; text-align: left; font-size: 22px; color: #999999;">短信验证码</div>
                    <div style="border-style: none none solid none; width: 650px; text-indent: 15px; height: 50px; line-height: 50px;margin:0 auto; border-bottom-width: 1px; border-bottom-color: #231b54;">
                        <table style="width:100%">
                            <tr>
                                <td>
                                    <input id="smsCode" name="smsCode" type="text" style="border-width: 0px; border-style: none; width: 100%; font-size: 20px; color: #231b54; height: 45px;outline:none;" />
                                    <input id="type" name="type" type="hidden" value="sms_registration" />
                                </td>
                                <td style="width:200px">
                                    <input id="Button1" onclick="formSubmit();" style="border-radius:5px;border-style: none; width: 175px; height: 45px; color: #FFFFFF; font-size: 18px; background-color: #34495e;" type="button" value="获取短信验证码" class="btn" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="height: 120px; text-align: center;">

                        <span id="spancode" style="font-size:20px;color:#ff0214; height: 23px; width: 100%; display:none; ">请输入正确验证码</span>
                    </div>
                    <span><input id="Button2" type="button" value="确认" onclick="loginSubmit();" style="border-radius:5px;border:none; background-position: 0px 0px; height: 90px; width: 250px; color: #FFFFFF; font-size: 24px; background-image: url('images/01login/button.png'); background-repeat: no-repeat; background-color: #fff;" class="btn" /></span>

                </td>
            </tr>

        </table>
    </div>

</form>
</body>
</html>